package com.ps.property;

import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.NoArgsConstructor;

import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import java.util.Date;

/**
 * 问题属性
 */
@ApiModel(description = "问题信息")
@Data
@NoArgsConstructor
public class QuestionVo {
  @ApiModelProperty(value = "问题ID",required = true)
//  @NotBlank(message = "问题ID不能为空")
  private int questionId;

  @ApiModelProperty(value = "用户ID",required = true)
  @NotNull(message = "用户ID不能为空")
  private int userId;

  @ApiModelProperty(value = "问题编号",required = true)
  @NotBlank(message = "问题编号不能为空")
  private String serialNumber;

  @ApiModelProperty(value = "分类名称",required = true)
  @NotBlank(message = "分类名称不能为空")
  private String classifyName;

  @ApiModelProperty(value = "问题标题",required = true)
  @NotBlank(message = "问题标题不能为空")
  private String questionTitle;

  @ApiModelProperty(value = "问题背景",required = true)
  @NotBlank(message = "问题背景不能为空")
  private String questionBackdrop;

  @ApiModelProperty(value = "图片路径",required = true)
  private String picturePath;

  @ApiModelProperty(value = "问题状态(1.上架  2.下架)",required = true)
  @NotNull(message = "问题状态不能为空")
  private int state;

  @ApiModelProperty(value = "是否推荐(1.是  2.否)",required = true)
  private int recommend;

  @ApiModelProperty(value = "是否置顶(1.是  2.否)",required = true)
  private int top;

  @ApiModelProperty(value = "问题浏览数",required = true)
  private int browseAmount;

  @ApiModelProperty(value = "回复条数",required = true)
  private int replyArticleNumber;

  @ApiModelProperty(value = "回复数量",required = true)
  private int replyAmount;

  @ApiModelProperty(value = "评论条数",required = true)
  private int commentAmount;

  @ApiModelProperty(value = "收藏人数",required = true)
  private int collectAmount;

  @ApiModelProperty(value = "发布时间",required = true)
  @JsonFormat(pattern="yyyy-MM-dd HH:mm:ss",timezone="GMT+8")
  private Date issueTime;

  @ApiModelProperty(value = "下架时间",required = true)
  @JsonFormat(pattern="yyyy-MM-dd HH:mm:ss",timezone="GMT+8")
  private Date soldOutTime;

  @ApiModelProperty(value = "创建时间",required = true)
  @JsonFormat(pattern="yyyy-MM-dd HH:mm:ss",timezone="GMT+8")
  private Date createTime;

  @ApiModelProperty(value = "更新时间",required = true)
  @JsonFormat(pattern="yyyy-MM-dd HH:mm:ss",timezone="GMT+8")
  private Date refreshTime;

  public QuestionVo(int questionId) {
    this.questionId = questionId;
  }

  public QuestionVo(@NotBlank(message = "问题标题不能为空") String questionTitle) {
    this.questionTitle = questionTitle;
  }
}
